//129

Definition for a binary tree node.
public class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode() {}
    TreeNode(int val) { this.val = val; }
    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}

class Solution {
  int ret = 0;
  public int sumNumbers(TreeNode root) {
      fun(root, 0);
      return ret;
  }

  public void fun(TreeNode root, int tmp) {
      if (root == null) {
          return;
      }
      if (root.left == null && root.right == null) {
          ret += (tmp10)+root.val;
          return;
      }
      fun(root.left, tmp  10 + root.val);
      fun(root.right, tmp  10 + root.val);
  }
}
//2331
Definition for a binary tree node.
public class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode() {}
    TreeNode(int val) { this.val = val; }
    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}

class Solution {
  public boolean evaluateTree(TreeNode root) {
      if (root.left == null && root.right == null) {
          return root.val == 0  false  true;
      }
      boolean l = evaluateTree(root.left);
      boolean r = evaluateTree(root.right);
      boolean ret = false;
      switch(root.val) {
          case 2 
          ret = l  r;
          break;
          case 3 
          ret = l && r;
          break;
      }
      return ret;
  }
}